The Picture object is used to represent a picture in an album.
sFileName | String | read-write | Full pathname of the picture. |
sShortFileName | String | read-only | Base filename of the picture. |
sComment | String | read-write | The full comment of the picture. |
sCommentFirstLine | String | read-only | The first line of comment of the picture. |
dwFileSize | Long | read-write | Size of the file containing the picture. |
lFileTime | Long | read-write | Date and time of the picture file. |
w | Long | read-write | Width of the picture in pixels. |
h | Long | read-write | Height of the picture in pixels. |
bpp | Long | read-write | Color depth of the picture. |
sURL | String | read-write | URL associated to the picture. |
sPlayCmd | String | read-write | Background music command for the picture. |
bSelected | Boolean | read-write | Selection state of the picture. |
lStatus | Long | read-write | Status of the picture. |
nbKeyword | Long | read-only | Number of keywords attached to this picture. |
nbCustomField | Long | read-only | Number of custom fields defined for this picture. |
Album | Object | read-only | The album the picture belongs to. |
num | Long | read-only | Position (0 based) of the picture in the album. |
next | Object | read-only | Next picture in the album. |
prev | Object | read-only | Previous picture in the album. |
nPicDataCount | Long | read-only | Number of picture data blocks. |
lDisplayMode | Long | read-write | Picture level display mode. |
lTransition | Long | read-write | Type of transition (hi-word) and delay in 1/10s (lo-word). |
rcCrop | Object | read-write | Cropping rectangle (rect object). |
nRotation | Long | read-write | Picture rotation (reserved). |
HasKeyword(pszKW As String) As Boolean
Test if the picture has the given keyword.
SetKeyword(pszKW As String, bSet As Boolean) As Boolean
Set or clear the specified keyword for the picture.
GetCustomField(pszCF As String) As String
Get the value of the specified custom field. This method can be used whatever the type of the custom field.
GetCustomFieldDate(pszCF As String) As Long
Get the time value (time_t) of the specified custom field. This method can only be used with date or time custom fields.
SetCustomField(pszCF As String, pszValue As String)
Set the string value of the specified custom field.
This method can only used with string custom fields.
SetCustomFieldDate(pszCF As String, lDateTime As Long)
Set the time value of the specified custom field. This method can only be used with date or time custom fields.
SaveThumbnail(sNewFile As String, nFileType As Long) As Boolean Save the thumbnail of the picture in a file.
ConvertAndResize(sNewFile As String, nFileType As Long, nNewWidth As Long, nNewHeight As Long) As Boolean
Convert and/or resize the picture and save it to a new file.
Set nNewWidth and nNewHeight to zero to keep the same dimensions.
ConvertAndResize2(sNewFile As String, nFileType As Long, nNewWidth As Long, nNewHeight As Long, nResizeMode as Long, crBack as Long, nAngle as Long) As Boolean
Extended version of ConvertAndResize. If nResizeMode = RM_BOUNDINGRECT (0), the specified size is the maximal size of the picture (preserving the aspect ratio), if nResizeMode = RM_EXACTSIZE (1) a border filled with the crBack color is added to match the specified size, if nResizeMode = RM_STRETCH (2) the picture is freely resized to the specified size (aspect ration non preserved). Rotation (angle must be 0, 90, 180 or 270) and cropping are available.
Resize(nNewWidth As Long, nNewHeight As Long, nResizeMode as Long, crBack as Long, nAngle as Long) As Boolean
Same as ConvertAndResize2 but the modified picture is not saved to a file and reside only in memory.
SetCropRect (l As Long, t As Long, r As Long, b as Long)
Set the cropping rectangle (left, top, right, bottom) used by ConvertAndResize2 and the display cropping.
Set all coordinates to zero to cancel cropping. Cropping rectangle can also be accessed with the rcCrop property.
UpdateThumbnail(bForce As Boolean) As Boolean
Update the thumbnail if the picture has changed or update it anyway if bForce is True.
Copy(nPic As Long) As Boolean
Copy the picture to the clipboard (nPic=-1, copy the thumbnail, nPic=0..n, copy the picture or one of the sub-pictures).
CopyRect(left As Long, top As Long, right As Long, bottom As Long, nPic As Long) As Boolean
Copy a rectangle from the picture to the clipboard. Coordinates are from the upper left corner of the picture. The nPic parameter is unused and must be zero.
PasteToThumbnail(bResize As Boolean) As Boolean
Replace the thumbnail with the bitmap content of the clipboard. If bResize is True, the bitmap is resized to match the album thumbnail size.
SetTextStampInfo(sText As String, sFont As String, crColor As Long, xPos As Long, yPos As Long) As Boolean Set the stamping information (text) for the ConvertAndResize method.
SetPictureStampInfo(sPicFile As String, xPos As Long, yPos As Long) As Boolean
Set the stamping information (bitmap) for the ConvertAndResize method.
Paste(xPos As Long, yPos As Long) As Boolean
Paste the bitmap from the clipboard to the picture at the specified position.
DrawText(sString As String, rect As Object, sFont As String, crColor As Long, crBkColor As Long, nFormat As Long) As Long
Draw a text on the picture. rect is the bounding text and must be a MyAlbum.rect object. Set crBkColor to -1 for a transparent background. For the nFormat use the DT_xxx constants of the DrawText Windows API.
DrawLine(x1 As Long, y1 As Long, x2 As Long, y2 As Long, nWidth as Long nStyle As Long, crColor As Long) As Long
Draw a line on the picture. nWidth specifies the style: 0 for solid, 1 for dashed.
DrawRectangle(rect As Object, nWidth As Long, crFrameColor As Long, crFillColor As Long, bStyle As Long, wE As Long, hE As Long) As Boolean
Draw a rectangle (nStyle=DRAWRECT_RECT (0)), a rounded rectangle (nStyle= DRAWRECT_ROUNDRECT (1)) or an ellipse (nStyle= DRAWRECT_ELLIPSE (2)) on the picture. rect specifies the size of the drawing and must be a MyAlbum.MyRect object. You can specify a border with a width (nWidth) and a color (crFrameColor or -1 for an unfilled drawing).
GetPixel(x As Integer, y As Integer) As Long
Gets the color of the pixel at coordinates x and y. 0,0 is the upper-left corner of the picture.
The returned value is coded in RGB (one byte for each color).
รป1 is returned if an error occurs (the picture must be a 8, 16, 24 or 32 bit per pixel bitmap).
SetPixel(x As Integer, y As Integer, color As Long)
Sets the color of the pixel at coordinates x and y. 0,0 is the upper-left corner of the picture.
The color parameter is coded in RGB (one byte for each color).
The picture must be a 16, 24 or 32 bit per pixel bitmap.
Mirror() As Boolean
Mirror the image (left <--> right).
Flip() As Boolean
Flip the image (top <--> bottom).
GetPicDataType(iPicData As Long) As Long
Get the type of a picture data block.
GetPicDataSize(iPicData As Long) As Long
Get the size of a picture data block.
SavePicData(iPicData As Long, sFile As String) As Boolean
Save a picture block in a file.
Load(bLoad As Boolean) As Boolean
Load (or unload) the picture in memory.
Save( sNewFile as String, bReplaceInAlbum As Boolean) As Boolean
Save the loaded picture to a new file (using its current state in memory).
Set the bReplaceInAlbum to True to have the new filename used
in the current album instead of the current picture filename.
Caution: Specifying the name of an existing file will overwrite it.
xmlEncode(nType as long, [optional] uFlags as Long) As String
Encode the picture as a XML string. nType is reserved and must be 0.
By default external files (the picture file and the files referenced by the Play Command)
are included in the xml stream.
Optional parameter: uFlags = XML_Default.
SetAsWallpaper(bUseCropRect as Boolean) As Boolean
Set the picture as the desktop wallpaper. Set bUseCropRect to True to use only the
part of the picture defined by its cropping rectangle.
MakeAnaglyph(picLeft As Object, picRight As Object, nAnaType As Short, dx As Short, dy As Short) As Boolean
Compute a 3D picture from two pictures.
Use the T3D_...
constants (see below) for the nAnaType parameter. The dx
and dy parameters are used to specify the offset of the right picture.
Picture status:
This is a 32 bit value containing various information:
Bit 0 to 7 | Picture type: | |
TYPE_NONE | 0 | Unknown |
TYPE_BMP | 1 | BMP |
TYPE_JPEG | 2 | JPEG |
TYPE_GIF | 3 | GIF |
TYPE_PNG | 4 | PNG |
TYPE_PCX | 5 | PCX |
TYPE_TIFF | 6 | TIFF |
TYPE_TGA | 7 | TGA |
TYPE_WMF | 8 | WMF/EMF |
10 - 11 | reserved | |
TYPE_VBS | 12 | VBS script |
TYPE_JS | 13 | JS script |
TYPE_WAVE | 14 | WAV |
TYPE_MIDI | 15 | MIDI |
TYPE_JPEGGIF | 16 | JPEG/GIF |
TYPE_JPEGPNG | 17 | JPEG/PNG |
TYPE_HTML | 20 | HTML |
TYPE_MP3 | 21 | MP3 |
TYPE_ALB | 30 | Album |
TYPE_VID | 31 | Video |
Bit 8 | STATE_NEW | Picture is new in album. |
Bit 9 | STATE_HIDDEN | Picture is hidden. |
Bit 10 | STATE_MULTI | Picture has sub-picture (animated GIF or TIFF). |
Bit 11 | STATE_METAFILE | Picture is a Metafile. |
Bit 12 | STATE_VIDEO | Picture is a video. |
Bit 16 | STATE_MARKED | Picture is marked (internal use). |
Bit 17 | STATE_FLAGGED | Picture is flagged (little red X). |
XML Export/Import options:
This is a 32 bit value containing the following information:
XML_Default | 0 | Default behaviour. |
XML_NoFiles | 1 | Export: Do not include the external files in the xml stream. |
XML_FullPathName | 2 | Export: Store the full pathname of the external files in the the xml stream. |
MakeAnaglyph constants:
T3D_AnaRedGreen | 0 | B&W anaglyph to be used with Red and Green glasses. |
T3D_AnaRedBlue | 1 | B&W anaglyph to be used with Red and Blue glasses. |
T3D_AnaRedCyan | 5 | B&W anaglyph to be used with Red and Cyan glasses. |
T3D_AnaColor | 2 | Pseudo-color anaglyph to be used with Red and Cyan glasses. |
T3D_InterlaceL | 3 | Produce an interlaced image (left picture first) to be used with LCD glasses. |
T3D_InterlaceR | 4 | Produce an interlace image (right picture first) to be used with LCD glasses. |